#!/usr/bin/env python
#coding:utf-8

import web
urls = (
    '/.*', 'index',
    '/(.*)/', 'redirect',
    '/hello', 'hello',
    )

app = web.application(urls, globals())

render = web.template.render('templates')

class index:
    def GET(self):
        i = web.input(id=None)
        if i.id:
            return 'hello ' + i.id
        else:
            return "hello, world!"

class hello:
    def GET(self):
        return render.hello('world')
    
class redirect:
    def GET(self):
        web.seeother('/' + path)
        
if __name__ == '__main__':
    #web.application(urls, globals()).run()
    app.run()
